package com.maple.test;

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p></p>
 *
 * @author maple
 */
@RestController
@RequestMapping("/test/thread")
public class ThreadTestController {

    @Resource
    private ThreadPoolTaskExecutor threadPool;

    @Resource
    private ThreadTestService testService;

    @RequestMapping("/test")
    public void someMethod() {
        threadPool.execute(() -> {
            // 任务逻辑
            System.out.println("async...");
        });
        System.out.println("end...");
    }

    @RequestMapping("/test2")
    public void someMethod2() {
        testService.sendMqInfo();
        System.out.println("end...");
    }

}
